﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace QYmall.Core.Model.ViewModels
{
    /// <summary>
    /// 商品SKU规格(显示)
    /// </summary>
    public class ShopSkusDto : ShopSkusBaseDto
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        public long Id { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Display(Name = "创建人")]
        [StringLength(128)]
        public string? AddBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime? AddTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 子规格列表
        /// </summary>
        public ICollection<ShopSkusChildrenDto> Children { get; set; } = new List<ShopSkusChildrenDto>();
    }

    /// <summary>
    /// 商品SKU规格(列表)
    /// </summary>
    public class ShopSkusListDto : ShopSkusBaseDto
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        public long Id { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Display(Name = "创建人")]
        [StringLength(128)]
        public string? AddBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime? AddTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 已删除：0否1是
        /// </summary>
        [Display(Name = "状态")]
        [Range(0, 9)]
        public byte IsDelete { get; set; } = 0;
    }

    /// <summary>
    /// 商品SKU规格(编辑)
    /// </summary>
    public class ShopSkusEditDto : ShopSkusBaseDto
    {
        /// <summary>
        /// 子规格列表
        /// </summary>
        public ICollection<ShopSkusChildrenDto> Children { get; set; } = new List<ShopSkusChildrenDto>();
    }

    /// <summary>
    /// 商品SKU规格(编辑)
    /// </summary>
    public class ShopSkusChildrenDto : ShopSkusBaseDto
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        public long Id { get; set; }

        /// <summary>
        /// 父规格ID
        /// </summary>
        [Display(Name = "父规格")]
        public long ParentId { get; set; } = 0;
    }

    /// <summary>
    /// 商品SKU规格(公共)
    /// </summary>
    public class ShopSkusBaseDto
    {
        /// <summary>
        /// 商户ID
        /// </summary>
        [Display(Name = "所属商户")]
        public int MerchantId { get; set; }

        /// <summary>
        /// 规格标题
        /// </summary>
        [Display(Name = "规格标题")]
        [Required]
        [StringLength(128)]
        public string? Title { get; set; }

        [Display(Name = "规格图片")]
        [StringLength(512)]
        public string? ImgUrl { get; set; }

        /// <summary>
        /// 备注说明
        /// </summary>
        [Display(Name = "备注说明")]
        [StringLength(512)]
        public string? Remark { get; set; }

        /// <summary>
        /// 排序数字
        /// </summary>
        [Display(Name = "排序数字")]
        public int SortId { get; set; } = 99;
    }
}
